<template>
	<view class="main">
		<!-- 状态栏 -->
		<topCommonTitleBar class="title_bar" statePerchHeight="90rpx" title="开通小竹会员" titleSize="34rpx" :statePerch="true"
			titleColor="#333333" arrow="black">
		</topCommonTitleBar>

		<!-- 内容区域 -->
		<scroll-view class="scroll" scroll-y="true">
			<!-- 个人信息和个人会员信息 -->
			<view class="user_vip">
				<view class="avatar_vip">
					<image class="avatar_img" :src="userInfo.avatar" mode="aspectFill"></image>
					<view class="vip_text">
						<text class="userName">
							{{ userInfo.nickname }}
						</text>
						<text class="vip_type_time"
							v-if="userInfo.is_vip == 1 || userInfo.is_vip == 3 || userInfo.is_vip == 4 || userInfo.is_vip == 5 || userInfo.is_vip == 6">
							{{ userInfo.is_vip == 1 ? '大会员' : userInfo.is_vip == 3 ? '超级会员' : userInfo.is_vip == 4 ? '企业会员-竹青会员' :
								userInfo.is_vip == 5 ? '企业会员-竹林会员' : '企业会员-竹海会员' }}（{{ userInfo.vip_end_time_text }}到期）
						</text>
						<text class="vip_type_time" v-else-if="userInfo.is_vip == 2">
							永久会员
						</text>
						<text class="vip_type_time" v-else-if="userInfo.is_vip == 0">
							您当前未开通任何会员
						</text>
					</view>
				</view>
				<!-- 兑换码 -->
				<view class="redeemCode" @click="goExChange">
					<image class="redeem_img" src="https://xzcs-public-files.oss-cn-beijing.aliyuncs.com/static/vip/discount.png">
					</image>
					<text class="redeem_text">兑换码</text>
				</view>
			</view>

			<!-- 会员类型 -->
			<view class="vip_type">
				<view class="tabs">
					<u-tabs :list="vipList" @click="tabsClick" lineColor="#FF6161" :current="current" :scrollable="false"
						:activeStyle="{
							color: '#000', fontSize: '36rpx', transform: 'scale(1)', fontWeight: 'bold'
						}" :inactiveStyle="{
	color: '#999', fontSize: '36rpx', transform: 'scale(1)', fontWeight: 'bold'
}" :itemStyle="{ height: '80rpx' }">
					</u-tabs>
				</view>



				<!-- 现有会员类型后有会员套餐 -->

				<!-- 超级会员 -->
				<view v-if="vipType == 2" class="super_wrap">
					<view class="super_item" v-for="(item, index) in setMealList" :key="index">
						<view class="item_time">
							{{ item.name }}
						</view>
						<view class="vip_price">
							<text class="icon fz40">¥</text>
							<text class="fz68 bold">{{ item.ios_price }}</text>
							<text class="old_price">¥{{ item.old_price }}</text>
						</view>
					</view>
				</view>
				<!-- 大会员和企业会员 -->
				<view v-if="vipType == 1 || vipType == 3" class="big_vip">
					<view class="big_item" v-for="(item, index) in setMealList" :key="index" @click="chooseSetMeal(item, index)"
						:class="{ active: packageCurrent == index }">
						<text class="type">{{ item.name }}</text>
						<view class="num">
							<text class="icon fz40">¥</text>
							<text class="fz68 bold">{{ item.ios_price }}</text>
						</view>
						<text v-if="vipType == 1" class="money">¥{{ item.old_price }}</text>
						<text v-if="item.id == 3" class="tips">限时特惠</text>
					</view>
				</view>
				<!-- 会员权益title -->
				<view class="vip_title">
					<view class="title_left_line"></view>
					<view class="title_dot"></view>
					<view class="title_text">会员权益对比</view>
					<view class="title_dot"></view>
					<view class="title_right_line"></view>
				</view>

				<!-- 会员权益 -->
				<view v-if="vipType == 1 || vipType == 2" class="vip_img">
					<image src="https://xzcs-public-files.oss-cn-beijing.aliyuncs.com/static/vip/vipDetail.png" class="img"
						mode="aspectFit"></image>
				</view>
				<view v-if="vipType == 3" class="vip_img">
					<image src="https://xzcs-public-files.oss-cn-beijing.aliyuncs.com/static/vip/firmVipDetail.png" class="firm_img"
						mode="aspectFit"></image>
				</view>
			</view>
		</scroll-view>


		<!-- 支付按钮 -->
		<view class="footer">
			<view class="button" @click="payment">
				同意协议并支付<text style="color: #FFF4CA;">¥<text style="font-size: 40rpx; color: #FFF4CA;">{{ truePrice
				}}</text></text>
			</view>
			<view class="agreement fz22 flex">
				<text style="color: #999;">开通前请阅读</text>
				<navigator url="/pages/my/vip/agreement?type=pay_xieyi&name=支付协议" hover-class="none">《支付协议》| </navigator>
				<navigator url="/pages/my/vip/agreement?type=vip_deal&name=会员协议" hover-class="none">《会员协议》</navigator>
			</view>
		</view>
	</view>
</template>

<script type="text/javascript" src="plus-confusion://../pages/my/vip"></script>

<style lang="scss" scoped>
.main {
	display: flex;
	// flex-direction: column;
	height: 100%;
	width: 100%;
	background-image: url('https://xzcs-public-files.oss-cn-beijing.aliyuncs.com/static/vip/vipBack.png');
	background-repeat: no-repeat;
	background-size: 100%;
	background-color: #fff;

}

.scroll {
	margin-top: 170rpx;
	height: calc(100vh - 347rpx);
}

.user_vip {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 30rpx;

	.avatar_vip {
		display: flex;
		align-items: center;
		padding-left: 35rpx;

		.avatar_img {
			width: 85rpx;
			height: 85rpx;
			border-radius: 85rpx;
		}

		.vip_text {
			display: flex;
			flex-direction: column;
			margin-left: 25rpx;

			.userName {
				color: #333;
				font-weight: 500;
				font-size: 30rpx;
			}

			.vip_type_time {
				margin-top: 7rpx;
				color: #666;
				font-size: 24rpx;
			}
		}
	}

	.redeemCode {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 164rpx;
		height: 44rpx;
		background-color: #FFEED9;
		border-top-left-radius: 50rpx;
		border-bottom-left-radius: 50rpx;
		border: 2rpx solid #DE8A23;

		.redeem_img {
			width: 26rpx;
			height: 26rpx;
		}

		.redeem_text {
			margin-left: 6rpx;
			font-size: 24rpx;
			color: #EE8D16;
		}
	}
}

.vip_type {
	margin-top: 54rpx;
	background-color: #fff;
	padding-bottom: 60rpx;

	.super_wrap {
		margin-top: 30rpx;
		padding: 0 36rpx;

		.super_item {
			padding: 0 27rpx 0 73rpx;
			width: 660rpx;
			height: 158rpx;
			border-radius: 15rpx;
			background-image: url('https://xzcs-public-files.oss-cn-beijing.aliyuncs.com/static/vip/superVipBack.png');
			background-repeat: no-repeat;
			background-size: 100%;
			border: 1rpx solid #FFD696;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.item_time {
				color: #945D0D;
				font-size: 32rpx;
			}

			.vip_price {
				color: #7E4D15;

				.old_price {
					margin-left: 10rpx;
					color: #AE7F49;
					font-size: 38rpx;
					text-decoration: line-through;
				}
			}
		}
	}

	.big_vip {
		margin-top: 30rpx;
		padding: 0 36rpx;
		display: flex;
		justify-content: space-between;

		.big_item {
			min-width: 210rpx;
			height: 275rpx;
			background: #FFFBF2;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			border-radius: 15rpx;
			position: relative;
			line-height: 1;
			border: 1rpx solid #F3EFE3;

			&.active {
				background-image: url('https://xzcs-public-files.oss-cn-beijing.aliyuncs.com/static/vip/bigVipBack.png');
				background-repeat: no-repeat;
				background-size: 100%;
				border: 1rpx solid #FFD696;

				.type {
					font-size: 28rpx;
					color: #945D0D;
				}

				.num {
					color: #7E4D15;
				}

				.money {
					font-size: 28rpx;
					color: #AE7F49;
				}
			}

			.type {
				font-size: 28rpx;
				line-height: 1;
				font-weight: 400;
				color: #777777;
			}

			.num {
				margin-top: 26rpx;
				color: #222222;
			}

			.money {
				margin-top: 22rpx;
				font-size: 28rpx;
				font-weight: 500;
				color: #777777;
				text-decoration: line-through;
			}

			.tips {
				font-size: 24rpx;
				width: 130rpx;
				height: 38rpx;
				background: #FE5C14;
				border-radius: 6rpx 6rpx 6rpx 0;
				text-align: center;
				line-height: 38rpx;
				color: #fff;
				position: absolute;
				left: 0;
				top: -19rpx;
			}
		}
	}

	.vip_title {
		margin-top: 52rpx;
		display: flex;
		align-items: center;
		justify-content: center;

		.title_left_line {
			width: 144rpx;
			height: 2rpx;
			background: linear-gradient(-90deg, #D8D8D8 0%, rgba(255, 255, 255, 0) 100%);
			margin-right: 5rpx;
		}

		.title_dot {
			width: 7rpx;
			height: 7rpx;
			border-radius: 7rpx;
			background: #D8D8D8;
		}

		.title_text {
			padding: 0 18rpx;
			color: #333333;
			font-size: 36rpx;
			font-weight: bold;
		}

		.title_right_line {
			width: 144rpx;
			height: 2rpx;
			background: linear-gradient(90deg, #D8D8D8 0%, rgba(255, 255, 255, 0) 100%);
			margin-left: 5rpx;
		}
	}

	.vip_img {
		margin-top: 35rpx;
		padding: 0 35rpx;
		display: flex;
		flex-direction: column;

		.img {
			width: 680rpx;
			height: 1068rpx;
		}

		.firm_img {
			width: 680rpx;
			height: 1274rpx;
		}
	}
}

.footer {
	height: 215rpx;
	width: 100%;
	position: fixed;
	left: 0;
	bottom: 0;
	padding: 25rpx 35rpx 44rpx 35rpx;
	border-top: 1rpx solid #E8E8E8;
	display: flex;
	flex-direction: column;
	align-items: center;
	background-color: #fff;

	.button {
		width: 680rpx;
		height: 90rpx;
		background: linear-gradient(90deg, #ED2B22 0%, #FE5D55 100%);
		border-radius: 56rpx;
		color: #fff;
		font-size: 28rpx;
		text-align: center;
		line-height: 90rpx;
	}

	.agreement {
		margin-top: 30rpx;
	}
}
</style>
